﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;


namespace QiCheXiaoShouGuanli.TXH
{
    public partial class DenLuJieMian : Form
    {
        public DenLuJieMian()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string DLzhanghao = this.zhanghao.Text.Trim();
            string DLmima = this.mima.Text.Trim();
            string DLyhlx = this.yhlx.Text;


           
                string sql = string.Format("Select * from DL where DLzhanghao='{0}' and DLmima='{1}' and DLyhlx='{2}' ", DLzhanghao, DLmima, DLyhlx);
                DataTable table = DBHelper.Read(sql);

                if (table.Rows.Count > 0)
                {
                    if(DLyhlx=="管理员")
                    {
                        zhujiemian from = new zhujiemian();
                        from.Show();
                        this.Hide();
                    }
                    else if(DLyhlx=="客户")
                    {
                        QiCheXiaoShouYongHu1.Form1 from = new QiCheXiaoShouYongHu1.Form1();
                        from.Show();
                        this.Hide();
                    }
                }
                else
                {
                    MessageBox.Show("账号或密码错误");
                }
             
              

            
        }

        private void DenLuJieMian_Load(object sender, EventArgs e)
        {
            DataTable cf = DBHelper.Read("select * from DL");
            this.yhlx.DisplayMember = "DLyhlx";
            this.yhlx.ValueMember = "DLid";
            this.yhlx.DataSource = cf;

            this.yhlx.SelectedIndex = 0;
        }

        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            WanJiMiMa from = new WanJiMiMa();
            from.ShowDialog ();
        }

        private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            ZhuChe from = new ZhuChe();
            from.ShowDialog();
        }
    }
}
